/*******************************************************************************
 * Copyright (c) 2012 Clever Devices.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 * 	Clever Devices Interns - 
 * 	Alex Frankel, Andria Young, Kevin Thomas, Nicholas Culpepper, Taner Oztimurlenk, Thomas Volberg
 ******************************************************************************/
package com.framework.cleverstop_tentative;


import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

/**
 * No backend code here.  However, the goal of this fragment would be
 * to log into a specific bustime account (from CTA or whoever).  This would populate
 * the Alerts (never created) section of OneStop with previously specified
 * prediction and service alerts
 * 
 * @author AFrankel
 *
 */
public class BusTimeLoginFragment extends DialogFragment implements OnClickListener {
	
	public BusTimeLoginFragment(String ta){
		taName = ta;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		
		View view = inflater.inflate(R.layout.bustime_signin, container);
		mUsername = (EditText) view.findViewById(R.id.btUsername);
		mPassword = (EditText) view.findViewById(R.id.btPassword);
		mUsername.requestFocus();
		getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
		
		mOk = (Button) view.findViewById(R.id.bOK);
		mCancel = (Button) view.findViewById(R.id.bCancel);
		
		mOk.setOnClickListener(this);
		mCancel.setOnClickListener(this);
		
		getDialog().setTitle("BusTime | " + taName);
		
		
		return view;
	}
	
	public void onClick(View id) {
		switch(id.getId()){
		case R.id.bOK:
			this.dismiss();
			break;
		case R.id.bCancel:
			this.dismiss();
			break;
		}
		
	}
	
	private EditText mUsername;
	private EditText mPassword;
	private Button mOk, mCancel;
	private String taName;


}
